﻿ 
<!DOCTYPE html>  
<html>  
<head>  
    <meta http-equiv="Content-Type" content="text/html; charset=UTF-8">  
    <meta name="keywords" content="公司">  
    <meta name="description" content="公司">  
    <title>公司管理</title>  
    
    <link rel="stylesheet" type="text/css" href="/pfw/jquery/easyui/themes/default/easyui.css">  
    <link rel="stylesheet" type="text/css" href="/pfw/jquery/easyui/themes/icon.css">  
    <link rel="stylesheet" type="text/css" href="/pfw/jquery/easyui/themes/form/form.css">   
    <script type="text/javascript" src="/pfw/jquery/jquery-1.9.1.min.js"></script>  
    <script type="text/javascript" src="/pfw/jquery/jquery-migrate-1.1.1.js"></script>
    <script type="text/javascript" src="/pfw/jquery/jquery.form.js"></script>  
    <script type="text/javascript" src="/pfw/jquery/easyui/jquery.easyui.min.js"></script>  
    <script type="text/javascript" src="/pfw/jquery/easyui/common/datagrid.js"></script>  
    <script type="text/javascript" src="/pfw/jquery/easyui/common/utils.js"></script>  
    
    <script type="text/javascript" src="/js/common.js"></script>
    <!--数据js-->
    <script type="text/javascript" src="/sysadmin/systemDic/listdic.do?isvar=1"></script>
	  <script type="text/javascript" src="/js/dic.js"></script>
	  <script type="text/javascript" src="/sysadmin/systemConstantDic/list.do?isvar=1"></script>
    <script type="text/javascript" src="/js/constantDic.js"></script>    

</head>  
<body>  
    
      
    <table id="dg" title="公司管理" class="easyui-datagrid" style="width:900px;height:250px"  
            url="/customer/company/list.do"  
            toolbar="#toolbar" pagination="true"  
            rownumbers="true" fitColumns="true" loadMsg="正在查询,请稍候..." singleSelect="false">  

    </table>  
    <div id="toolbar">  
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-add" plain="true" onclick="add()">新增</a>  
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-edit" plain="true" onclick="edit()">修改</a>  
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="deletes()">删除</a>  
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-remove" plain="true" onclick="find()">查询</a>
    </div>  
    <!-- edit form窗体（开始） -->  
    <div id="dlg" class="easyui-dialog" style="width:600px;height:280px;padding:10px 20px"  
            closed="true" buttons="#dlg-buttons">  
        <form id="fm" method="post" novalidate>  
        	  	  	 <input type="hidden" name="id" > 
	        		     <div class="fitem">  
                     <label style="width:100px">公司名<font color="red">*</font>:</label>                                            
                     <input name="name" class="easyui-box easyui-validatebox"  required="true">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">全名:</label>                                            
                     <input name="fullName" class="easyui-box">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">abbrName:</label>                                            
                     <input name="abbrName" class="easyui-box">                       
                   </div> 
        	  	   	 <div class="fitem">  
                     <label style="width:100px">行业:</label>  
                     <input class="easyui-combobox" name="industry" style="width:200px;"  data-options="data:__getCategory('INDUSTRY'),valueField:'id', textField:'codeNameCn', multiple:false,panelHeight:'auto',mode:'remote' ">
                   </div>  	        	  	   	
        	  	   	 <div class="fitem">  
                     <label style="width:100px">公司性质:</label>  
                     <input class="easyui-combobox" name="property" style="width:200px;"  data-options="data:__getCategory('COMPANY_NATURE'),valueField:'id', textField:'codeNameCn', multiple:false,panelHeight:'auto',mode:'remote' ">
                   </div>  	        	  	   	
        	  	   	 <div class="fitem">  
                     <label style="width:100px">机构类型:</label>  
                     <input class="easyui-combobox" name="type" style="width:200px;"  data-options="data:__getCategory('ORGANIZATION_TYPE'),valueField:'id', textField:'codeNameCn', multiple:false,panelHeight:'auto',mode:'remote' ">
                   </div>  	        	  	   	
	        		     <div class="fitem">  
                     <label style="width:100px">电话总机:</label>                                            
                     <input name="tel" class="easyui-box">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">网站:</label>                                            
                     <input name="website" class="easyui-box">                       
                   </div> 
        	  	   	 <div class="fitem">  
                     <label style="width:100px">城市:</label>  
                     <input class="easyui-combobox" name="location" style="width:200px;"  data-options="data:__getCategory('LOCATION'),valueField:'id', textField:'codeNameCn', multiple:false,panelHeight:'auto',mode:'remote' ">
                   </div>  	        	  	   	
	        		     <div class="fitem">  
                     <label style="width:100px">地址:</label>                                            
                     <input name="address" class="easyui-box">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">邮编:</label>                                            
                     <input name="postcode" class="easyui-box">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">公司简介:</label>                                            
                     <input name="profile" class="easyui-box">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">显示在职位中的公司简介:</label>                                            
                     <input name="jobProfile" class="easyui-box">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">资本结构描述:</label>                                            
                     <input name="capital" class="easyui-box">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">公司背景发展历史:</label>                                            
                     <input name="background" class="easyui-box">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">公司业务/产品:</label>                                            
                     <input name="product" class="easyui-box">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">产品与行业地位:</label>                                            
                     <input name="productLevel" class="easyui-box">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">注册资本:</label>                                            
                     <input name="regCapital" class="easyui-box">                       
                   </div> 
        	  	   	 <div class="fitem">  
                     <label style="width:100px">人员规模:</label>  
                     <input class="easyui-combobox" name="size" style="width:200px;"  data-options="data:__getCategory('COMPANY_SIZE'),valueField:'id', textField:'codeNameCn', multiple:false,panelHeight:'auto',mode:'remote' ">
                   </div>  	        	  	   	
	        		     <div class="fitem">  
                     <label style="width:100px">公司文化以及雇主口碑:</label>                                            
                     <input name="culture" class="easyui-box">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">竞争公司:</label>                                            
                     <input name="competeCompanys" class="easyui-box">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">创建人:</label>                                            
                     <input name="creator" class="easyui-box">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">创建时间:</label>                       
                     <input name="createDt" class="easyui-datebox">                       
                   </div>  	        		     
	        		     <div class="fitem">  
                     <label style="width:100px">修改人:</label>                                            
                     <input name="modifier" class="easyui-box">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">修改时间:</label>                       
                     <input name="modifiedDt" class="easyui-datebox">                       
                   </div>  	        		     
	        		     <div class="fitem">  
                     <label style="width:100px">传真:</label>                                            
                     <input name="fax" class="easyui-box">                       
                   </div> 
        	  	   	 <div class="fitem">  
                     <label style="width:100px">完整度:</label>  
                     <input class="easyui-combobox" name="integrity" style="width:200px;"  data-options="data:__getConstantCategory('CompanyIntegrity'),valueField:'code', textField:'value', multiple:false,panelHeight:'auto',mode:'remote' ">
                   </div>  	        	  	   	
	        		     <div class="fitem">  
                     <label style="width:100px">是否删除:</label>                       
                     <input name="isDelete" class="easyui-numberbox">                       
                   </div>	        		     
	        		     <div class="fitem">  
                     <label style="width:100px">删除时间:</label>                       
                     <input name="deleteDt" class="easyui-datebox">                       
                   </div>  	        		     
        </form>  
    </div>  
    <!-- edit form窗体（结束） -->  
    <!-- query form窗体(开始) -->  
    <div id="dlg_query" class="easyui-dialog" style="width:400px;height:280px;padding:10px 20px"  
            closed="true" buttons="#dlg-buttons-query">  
        <div class="ftitle">公司</div>  
        <form id="fm_query" method="post" novalidate>  
            
              
	        		     <div class="fitem">  
                     <label style="width:100px">公司名:</label>                                            
                     <input name="name" class="easyui-box">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">全名:</label>                                            
                     <input name="fullName" class="easyui-box">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">abbrName:</label>                                            
                     <input name="abbrName" class="easyui-box">                       
                   </div> 
        	  	   	 <div class="fitem">  
                     <label style="width:100px">行业:</label>                                            
                     
                     
                     <input class="easyui-combobox" name="industry" style="width:200px;"  data-options="data:__getCategory('INDUSTRY'),valueField:'id', textField:'codeNameCn', multiple:false,panelHeight:'auto',mode:'remote' ">
                     
                   </div>      	
        	  	   	 <div class="fitem">  
                     <label style="width:100px">公司性质:</label>                                            
                     
                     
                     <input class="easyui-combobox" name="property" style="width:200px;"  data-options="data:__getCategory('COMPANY_NATURE'),valueField:'id', textField:'codeNameCn', multiple:false,panelHeight:'auto',mode:'remote' ">
                     
                   </div>      	
        	  	   	 <div class="fitem">  
                     <label style="width:100px">机构类型:</label>                                            
                     
                     
                     <input class="easyui-combobox" name="type" style="width:200px;"  data-options="data:__getCategory('ORGANIZATION_TYPE'),valueField:'id', textField:'codeNameCn', multiple:false,panelHeight:'auto',mode:'remote' ">
                     
                   </div>      	
	        		     <div class="fitem">  
                     <label style="width:100px">电话总机:</label>                                            
                     <input name="tel" class="easyui-box">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">网站:</label>                                            
                     <input name="website" class="easyui-box">                       
                   </div> 
        	  	   	 <div class="fitem">  
                     <label style="width:100px">城市:</label>                                            
                     
                     
                     <input class="easyui-combobox" name="location" style="width:200px;"  data-options="data:__getCategory('LOCATION'),valueField:'id', textField:'codeNameCn', multiple:false,panelHeight:'auto',mode:'remote' ">
                     
                   </div>      	
	        		     <div class="fitem">  
                     <label style="width:100px">地址:</label>                                            
                     <input name="address" class="easyui-box">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">邮编:</label>                                            
                     <input name="postcode" class="easyui-box">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">公司简介:</label>                                            
                     <input name="profile" class="easyui-box">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">显示在职位中的公司简介:</label>                                            
                     <input name="jobProfile" class="easyui-box">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">资本结构描述:</label>                                            
                     <input name="capital" class="easyui-box">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">公司背景发展历史:</label>                                            
                     <input name="background" class="easyui-box">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">公司业务/产品:</label>                                            
                     <input name="product" class="easyui-box">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">产品与行业地位:</label>                                            
                     <input name="productLevel" class="easyui-box">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">注册资本:</label>                                            
                     <input name="regCapital" class="easyui-box">                       
                   </div> 
        	  	   	 <div class="fitem">  
                     <label style="width:100px">人员规模:</label>                                            
                     
                     
                     <input class="easyui-combobox" name="size" style="width:200px;"  data-options="data:__getCategory('COMPANY_SIZE'),valueField:'id', textField:'codeNameCn', multiple:false,panelHeight:'auto',mode:'remote' ">
                     
                   </div>      	
	        		     <div class="fitem">  
                     <label style="width:100px">公司文化以及雇主口碑:</label>                                            
                     <input name="culture" class="easyui-box">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">竞争公司:</label>                                            
                     <input name="competeCompanys" class="easyui-box">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">创建人:</label>                                            
                     <input name="creator" class="easyui-box">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">创建时间:</label>                       
                     <input name="createDt" class="easyui-datebox">                         	
                   </div>  	        		     
	        		     <div class="fitem">  
                     <label style="width:100px">修改人:</label>                                            
                     <input name="modifier" class="easyui-box">                       
                   </div> 
	        		     <div class="fitem">  
                     <label style="width:100px">修改时间:</label>                       
                     <input name="modifiedDt" class="easyui-datebox">                         	
                   </div>  	        		     
	        		     <div class="fitem">  
                     <label style="width:100px">传真:</label>                                            
                     <input name="fax" class="easyui-box">                       
                   </div> 
        	  	   	 <div class="fitem">  
                     <label style="width:100px">完整度:</label>                                            
                     
                     
                     <input class="easyui-combobox" name="integrity" style="width:200px;"  data-options="data:__getConstantCategory('CompanyIntegrity'),valueField:'code', textField:'value', multiple:false,panelHeight:'auto',mode:'remote' ">
                     
                   </div>      	
	        		     <div class="fitem">  
                     <label style="width:100px">是否删除:</label>                       
                     <input name="isDelete" class="easyui-numberbox">                       
                   </div>	        		     
	        		     <div class="fitem">  
                     <label style="width:100px">删除时间:</label>                       
                     <input name="deleteDt" class="easyui-datebox">                         	
                   </div>  	        		     
              
              
        </form>  
    </div> 
    <!-- query form窗体(结束) -->  
    <div id="dlg-buttons">  
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onclick="save()">Save</a>  
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlg').dialog('close')">Cancel</a>  
    </div>  
    <div id="dlg-buttons-query">  
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-ok" onclick="query()">确定</a>  
        <a href="javascript:void(0)" class="easyui-linkbutton" iconCls="icon-cancel" onclick="javascript:$('#dlg_query').dialog('close')">Cancel</a>  
    </div>  
    <script type="text/javascript">  
        var url;  
        function add(){         	 
            $('#dlg').dialog('open').dialog('setTitle','新增公司');  
            $('#fm').form('clear');  
            url = '/customer/company/save.do';  
        }  
        function edit(){  
            //var row = $('#dg').datagrid('getSelected');  
            var rows = $('#dg').datagrid('getSelections');
            if (!rows||rows.length==0){
            	 $.messager.alert('提示','请选择要修改的行','info');
            	 return;
            }
            if (!rows||rows.length>1){
            	 $.messager.alert('提示','不能选择多行','info');
            	 return;
            }
            if (rows){  
                $('#dlg').dialog('open').dialog('setTitle','修改公司');  
                //$('#fm').form('load',rows[0]);  
                $('#fm').form('load','/customer/company/get.do?id='+rows[0].id);  
                url = '/customer/company/update.do';
            }  
        }  
        function save(){          	   
        	  if (!$('#fm').form('validate')) return; 
            $('#fm').form('submit',{  
                url: url,  
                onSubmit: function(){  
                    return $(this).form('validate');  
                },  
                success: function(result){  
                    var result = eval('('+result+')');  
                    console.log(result);
                    if (result.success == true){  
                        $.messager.alert('信息',result.msg,'info');  
                        $('#dlg').dialog('close');      // close the dialog  
                        $('#dg').datagrid('reload');    // reload the user data  
                    } else {  
                        $.messager.alert('错误',result.msg,'error');
                    }  
                }  
            });  
        }  
        function deletes(){  
            var row = $('#dg').datagrid('getSelected');  
            
            var rows = $('#dg').datagrid('getSelections');  

            if (!rows||rows.length==0){
            	 $.messager.alert('提示','请选择要删除的行','info');
            	 return;
            }
            if (rows){  
                $.messager.confirm('重要提示','确定要删除?',function(r){  
                    if (r){  
                        $.post('/customer/company/delete.do',{ids:getRecordArray(rows,'id').join(',')},function(result){  
                            if (result.success){  
                                $('#dg').datagrid('reload');    // reload the user data  
                            } else {  
                                 
                                $.messager.alert('错误',result.errorMsg,'error'); 
                            }  
                        },'json');  
                    }  
                });  
            }  
        }  
        function find(){  
              
                $('#dlg_query').dialog('open').dialog('setTitle','查询');  
                
                url = '/customer/company/jsonlist.do';  
              
        } 
        	
        function query(){  
                
                //var aa=$('#fm_query').formSerialize();
                var formdata=$('#fm_query').formToArray();
                //var dd= JSON.stringify(cc); 
                
                if (!$('#fm_query').form('validate')) return; 
                $('#dg').datagrid({
	                  queryParams: array2json(formdata)
                });
               $('#dlg_query').dialog('close');
              
        }
        
        //生成grid的字段,需要字典的自动转换
        $('#dg').datagrid({
        	   columns:[[
        	   	
        	   	   {field:'name',title:'公司名', width:100}
        	   	   ,{field:'fullName',title:'全名', width:100}
        	   	   ,{field:'abbrName',title:'abbrName', width:100}
        	   	   ,{field:'industry',title:'行业', width:100,
        	   		      formatter: function(value,row,index){
        	   		      	return __getCategroyCodeValue('INDUSTRY', value);
        	   		      }
        	   	     }
        	   	   ,{field:'property',title:'公司性质', width:100,
        	   		      formatter: function(value,row,index){
        	   		      	return __getCategroyCodeValue('COMPANY_NATURE', value);
        	   		      }
        	   	     }
        	   	   ,{field:'type',title:'机构类型', width:100,
        	   		      formatter: function(value,row,index){
        	   		      	return __getCategroyCodeValue('ORGANIZATION_TYPE', value);
        	   		      }
        	   	     }
        	   	   ,{field:'tel',title:'电话总机', width:100}
        	   	   ,{field:'website',title:'网站', width:100}
        	   	   ,{field:'location',title:'城市', width:100,
        	   		      formatter: function(value,row,index){
        	   		      	return __getCategroyCodeValue('LOCATION', value);
        	   		      }
        	   	     }
        	   	   ,{field:'address',title:'地址', width:100}
        	   	   ,{field:'postcode',title:'邮编', width:100}
        	   	   ,{field:'profile',title:'公司简介', width:100}
        	   	   ,{field:'jobProfile',title:'显示在职位中的公司简介', width:100}
        	   	   ,{field:'capital',title:'资本结构描述', width:100}
        	   	   ,{field:'background',title:'公司背景发展历史', width:100}
        	   	   ,{field:'product',title:'公司业务/产品', width:100}
        	   	   ,{field:'productLevel',title:'产品与行业地位', width:100}
        	   	   ,{field:'regCapital',title:'注册资本', width:100}
        	   	   ,{field:'size',title:'人员规模', width:100,
        	   		      formatter: function(value,row,index){
        	   		      	return __getCategroyCodeValue('COMPANY_SIZE', value);
        	   		      }
        	   	     }
        	   	   ,{field:'culture',title:'公司文化以及雇主口碑', width:100}
        	   	   ,{field:'competeCompanys',title:'竞争公司', width:100}
        	   	   ,{field:'creator',title:'创建人', width:100}
        	   	   ,{field:'createDt',title:'创建时间', width:100}
        	   	   ,{field:'modifier',title:'修改人', width:100}
        	   	   ,{field:'modifiedDt',title:'修改时间', width:100}
        	   	   ,{field:'fax',title:'传真', width:100}
        	   	   ,{field:'integrity',title:'完整度', width:100,
        	   		      formatter: function(value,row,index){
        	   		      	return __getConstantCategoryCodeValue('CompanyIntegrity', value);
        	   		      }
        	   	     }
        	   	   ,{field:'isDelete',title:'是否删除', width:100}
        	   	   ,{field:'deleteDt',title:'删除时间', width:100}
        	   	
        	   	
        	   ]]
        }); 
        //完成-生成grid的字段
        
        
        
         $('#dg').datagrid({
        	    onDblClickRow: function(rowIndex, rowData){
        	    	$('#dlg').dialog('open').dialog('setTitle','修改公司');                  
                $('#fm').form('load','/customer/company/get.do?id='+rowData.id);  
                url = '/customer/company/update.do';        	    	
        	    }
        });
    </script>  
     
     

     
     
     
</body>  
</html>